-
Notifications
You must be signed in to change notification settings - Fork 69
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add multi package support #220
Add multi package support #220
Conversation
1e07c34
to
dee3e23
Compare
PR force updated after it failed previously because of prettier lint issues |
Thank you for this! Let me know after you have a chance to test the package as a dependency of some project that uses ESM. @AGalabov could you take a look as well, also do you have somewhere we can test the CJS importing before a release? |
package.json
Outdated
"import": "./dist/mjs/index.js", | ||
"require": "./dist/cjs/index.js" | ||
} | ||
}, | ||
"types": "dist/index.d.ts", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't the types be exported from a subfolder now as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that looks like something new (to me) . I followed this guide as to support nodejs and typescript for older and newer versions; https://devblogs.microsoft.com/typescript/announcing-typescript-4-7/#package-json-exports-imports-and-self-referencing
fb6e952
to
493ceb8
Compare
@danielkarso-pon did you manage to test this? I just tried setting up some test projects. From what I see the current setup would not fully work. One thing that I saw as a problem was that the compiled js files for ESM modules are lacking the file extension |
@danielkarso-pon @georgyangelov - I opened an alternative PR using Rollup as a small module bundler to work around the inconveniences of transpiling the files and imports by combining them into a single file. I am open for reviews and comments. I managed to test in a small project + the project mentioned here |
@danielkarso-pon thank you once again for the contribution, ideas and the review. I will go ahead with the other PR as we agreed |
Via: https://www.sensedeep.com/blog/posts/2021/how-to-create-single-source-npm-module.html